package string_learn.oj;

/**
 * @author yuisama
 * @date 2022/09/21 21:21
 * 字符串常量池的理解
 **/
public class StringTheory {
    public static void main(String[] args) {
        String str = "hello";
        String str1 = "hello";
        String str2 = new String("hello");
        str2 = str2.intern();
        System.out.println(str == str1);
        System.out.println(str == str2);
//        char[] ch = new char[] {'a','b','c'};
//        String s1 = new String(ch);
//        s1.intern();
//        String s2 = "abc";
//        // 输出true还是false
//        System.out.println(s1 == s2);
    }
}